package autoRegister;
import java.util.Random;
public class GetRandom
{
    public static final String allChar = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
    public static final String numberChar = "0123456789";
    public static String generateString() //参数为返回随机数的长度
    {
        StringBuffer sb = new StringBuffer();
        Random random = new Random();
        for (int i = 0; i < 8; i++)
        {
            sb.append(allChar.charAt(random.nextInt(allChar.length())));
        }
        return sb.toString();
    }
    public static String generatePhoneString() //参数为返回随机数的长度
    {
        StringBuffer sb = new StringBuffer();
        Random random = new Random();
        sb.append('1');
        for (int i = 0; i < 10; i++)
        {
            sb.append(allChar.charAt(random.nextInt(numberChar.length())));
        }
        return sb.toString();
    }
    public static void main(String [] args)
    {
        String ccxl=generatePhoneString();
        System.out.print(ccxl);
    }
}
